package com.buss.product.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.buss.core.dic.RecordStatus;

@Entity
@Table(name="base_brand")
@TableGenerator(name="brand_pk_sequence",initialValue=1,allocationSize=1,pkColumnName="seq_col",
pkColumnValue="brand_seq",valueColumnName="seq_val",table="product_pk_sequence")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@JsonIgnoreProperties(value={"categorys"})
public class Brand implements Serializable {
	
	private static final long serialVersionUID = -4234164004496388515L;

	/**品牌ID*/
	@Id
	@GeneratedValue(strategy=GenerationType.TABLE,generator="brand_pk_sequence")
	private Long id;
	
	/**品牌名称*/
	@Column(nullable=false,length=100)
	private String name;
	
	/**拼音码*/
	@Column(nullable=false,length=100)
	private String pinyin;
	
	/**单位编码*/
	@Column(nullable=false,length=20)
	private String companyId;
	
	/**品牌Logo图片路径*/
	@Column(length=255)
	private String logoPath;
	
	/**品牌描述*/
	@Column(length=2000)
	private String intro;
	
	/**排序序号*/
	private Long sortOrder;
	
	/**记录状态*/
	@Enumerated(value=EnumType.STRING)
	private RecordStatus status;
	
	/**商品分类*/
	@ManyToMany(cascade=CascadeType.REFRESH,fetch=FetchType.LAZY,mappedBy="brands")
	private List<GoodsCategory> categorys;

	public Brand(){}
	
	public Brand(Long id,String name,String pinyin){
		this.id = id;
		this.name = name;
		this.pinyin = pinyin;
	}
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCompanyId() {
		return companyId;
	}

	public void setCompanyId(String companyId) {
		this.companyId = companyId;
	}

	public String getLogoPath() {
		return logoPath;
	}

	public void setLogoPath(String logoPath) {
		this.logoPath = logoPath;
	}

	public String getIntro() {
		return intro;
	}

	public void setIntro(String intro) {
		this.intro = intro;
	}

	public Long getSortOrder() {
		return sortOrder;
	}

	public void setSortOrder(Long sortOrder) {
		this.sortOrder = sortOrder;
	}

	public RecordStatus getStatus() {
		return status;
	}

	public void setStatus(RecordStatus status) {
		this.status = status;
	}

	public String getPinyin() {
		return pinyin;
	}

	public void setPinyin(String pinyin) {
		this.pinyin = pinyin;
	}

	public List<GoodsCategory> getCategorys() {
		return categorys;
	}

	public void setCategorys(List<GoodsCategory> categorys) {
		this.categorys = categorys;
	}
	
}
